﻿using STHPMS1.BLL.B_Core;
using STHPMS1.Common.C_Entity.Stmpms1;
using STHPMS1.ICore.I_BLL.Bus;
using STHPMS1.ICore.I_DAL;
using STHPMS1.ICore.I_Entity.Info;
using STHPMS1.ICore.I_Entity.Stmpms1;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;

namespace STHPMS1.BLL.B_Bus
{
    public class Df_Dailymian_CostBus : BllBase, IDf_Dailymian_CostBill
    {
        public void Save<T>(T entity)
            where T : class ,IDf_Dailymian_Cost
        {
            if (this.Scene.Dal.Sthpms1.Update(entity) == 0)
            {
                this.Scene.Dal.Sthpms1.Insert(entity);
            }
        }

        public void Remove(IDf_Dailymian_Cost entity)
        {
            this.Scene.Dal.Sthpms1.Delete(entity);
        }

        public IEnumerable<T> Get<T>(Expression<Func<T, bool>> predicate, IPagingInfo info)
            where T : class, IDf_Dailymian_Cost
        {
            return this.Scene.Dal.Sthpms1.Select<T>(predicate, info,k=>k.Pvmttype,false);
        }


        /// <summary>
        /// 获取路面日常养护单价
        /// </summary>
        /// <param name="pvmttype">路面类型</param>
        /// <param name="rd_class">技术等级</param>
        /// <param name="year">通车年限</param>
        /// <returns></returns>
        public double GetDaily_Unitcost(int pvmttype, string rd_class,int year)
        {
            return this.Scene.Dal.Sthpms1.Df_Dailymian_Cost.GetDaily_Unitcost(pvmttype, rd_class,year);
        }

    }
}
